<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app"></div>
    <script>
        //创建节点的就是构建出DOM对象，然后根据需要添加到其他节点中
        document.body.append((document.createElement('div').innerText = '唐玮'));
    //   console.log(divs);

    //也可以直接添加文本
    document.body.append("cdtw.com")
    //创建文本对象
    let app = document.querySelector('#app');
  let text = document.createTextNode("hpudunren.com");
  app.append(text)
     //向div添加元素
     let divss=document.querySelector("#app");
     let span_element=document.createElement("span");
     span_element.innerHTML="创建的span元素";
     divss.append(span_element);

    </script>
</body>
</html>